<!DOCTYPE html>
<html>
<head>
    <title>工厂材料价格表</title>
    <#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <el-row>
            <el-col :span="12">
                <div style="padding-bottom: 15px">
                    <el-button-group>
                        <el-button type="primary" size="small" icon="el-icon-plus" @click="addMaterial">增加</el-button>
                    </el-button-group>
                </div>
                <el-table :data="leftTableData" ref="leftTableData" border="true" class="tb-edit" style="width: 100%" highlight-current-row @row-click="handleCurrentChange">
                    <el-table-column type="index"  width="50"> </el-table-column>
                    <el-table-column label="材料名称" width="180" prop="optionName">
                        <template scope="scope">
                         <span @change="handleEdit(scope.$index, scope.row)">{{scope.row.optionName}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="工厂名字" width="180" prop="sellerName">
                        <template scope="scope">
                          <span @change="handleEdit(scope.$index, scope.row)">{{scope.row.sellerName}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="特种纸张" width="100" prop="specialtyPaper">
                        <template scope="scope">
                          <span @change="handleEdit(scope.$index, scope.row)" v-if="scope.row.specialtyPaper">是</span>
                          <span @change="handleEdit(scope.$index, scope.row)" v-else>否</span>
                          <!--<span @change="handleEdit(scope.$index, scope.row)">{{scope.row.specialtyPaper}}</span>-->
                        </template>
                    </el-table-column>
                    <el-table-column label="创建时间" width="180" prop="createDate">
                        <template scope="scope">
                          <span @change="handleEdit(scope.$index, scope.row)">{{scope.row.createDate}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作">
                    <template scope="scope">
                    <el-button size="small" type="danger" @click.native.prevent="handleDelete(scope.$index, scope.row)">删除</el-button>
                    </template>
                    </el-table-column>
                    <el-table-column label="设为特种纸">
                    <template scope="scope">
                        <el-switch
                                v-model="scope.row.specialtyPaper"
                                active-color="#13ce66"
                                inactive-color="#ff4949"
                                @click.native.prevent="specialPaper(scope.$index, scope.row)">
                        </el-switch>
                    </template>
                    </el-table-column>
                </el-table>
            </el-col>
            <el-col :span="12">
                <el-table :data="tableData" ref="tableData" class="tb-edit" style="width: 100%;/*position: fixed*/" highlight-current-row @row-click="tableDataChange">
                    <el-table-column
                            type="index"
                            width="50">
                    </el-table-column>
                    <el-table-column label="材料克重" width="180" prop="optionName2">
                        <template scope="scope">
                             <span>{{scope.row.optionName2}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="采购价(元)" width="180" prop="materialPrice">
                        <template scope="scope">
                            <el-input size="small" v-model="scope.row.materialPrice" @change="handleEdit(scope.$index, scope.row)" placeholder="请输入内容"></el-input> <span>{{scope.row.materialPrice}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="上浮系数" width="180" prop="floatingCoefficient">
                        <template scope="scope">
                            <el-input size="small" v-model="scope.row.floatingCoefficient" @change="handleEdit(scope.$index, scope.row)" placeholder="请输入内容"></el-input> <span>{{scope.row.floatingCoefficient}}</span>
                        </template>
                    </el-table-column>
                    <!--<el-table-column label="特种纸" width="180" prop="isSpecialtyPaper">-->
                        <!--<template scope="scope">-->
                            <!--<el-input size="small" v-model="scope.row.isSpecialtyPaper" @change="handleEdit(scope.$index, scope.row)" placeholder="特种纸"></el-input> <span>{{scope.row.isSpecialtyPaper}}</span>-->
                        <!--</template>-->
                    <!--</el-table-column>-->
                </el-table>
                <div class="form-group">
                    <div class="col-sm-2 control-label"></div>
                    <input type="button" class="btn btn-primary  btn-sm" @click="saveOrUpdate" value="确定"/>
                </div>
            </el-col>
        </el-row>
    </div>

    <!--新增材料-->
    <el-dialog  title="增加材料" :visible.sync="addMaterialView" width="600px">
        <el-row>
            <el-col :span="12">
                <el-table :data="quoteAttributeOptionList" stripe="true"  border="true" size="small"  highlight-current-row="true" style="width: 100%" max-height="400" @row-click="handleaddMaterial" @selection-change="changeFun">
                    <el-table-column type="selection" width="55"> </el-table-column>
                    <el-table-column fixed prop="optionName"  label="材料名称" width="200"> </el-table-column>
                </el-table>
            </el-col>
            <el-col :span="12">
                <el-table :data="addMaterialViewListL" stripe="true"  border="true" size="small"  highlight-current-row="true" style="width: 80%" max-height="400">
                    <el-table-column fixed prop="optionName2"  label="克重" width="200"> </el-table-column>
                </el-table>
            </el-col>
        </el-row>

        <span slot="footer" class="dialog-footer">
                <el-button @click="addMaterialView = false">取 消</el-button>
                <el-button type="primary" @click="addToLeftTable" :disabled="disable">加入</el-button>
            </span>
    </el-dialog>

</div>

<script src="${request.contextPath}/statics/js/modules/quoteFactoryMaterial/quotefactorymaterial.js?_${.now?long}"></script>
<style>
    * {
        margin: 0;
        padding: 0
    }
    body {
        font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
        overflow: auto;
        font-weight: 400;
        -webkit-font-smoothing: antialiased;
    }
    .tb-edit .el-input {
        display: none
    }
    .tb-edit .current-row .el-input {
        display: block
    }
    .tb-edit .current-row .el-input+span {
        display: none
    }
    /* 设置当前选中行的背景颜色 */
    .el-table__body tr.current-row>td {
        background: #c9eff5 !important;
    }
</style>
</body>
</html>